https://leetcode.cn/problems/max-consecutive-ones-iii/
//滑动窗口
class Solution {
public:
    int longestOnes(vector<int>& nums, int k) {
        int left=0,right=0;
        int ret=0;
        int len=0;
        while(right<nums.size())
        {
            if(nums[right]==0)
             ret++;
            while(ret>k)
            {
                if(nums[left++]==0)
                ret--;
            }
            len=max(len,right-left+1);
            right++;
        }
        return len;
    }
};